// @ts-nocheck
import Vue from "vue";
import VueRouter from "vue-router";
//import Home from "../views/Home.vue";
import Login from "../views/Login.vue";
import Register from "../views/Register.vue";
import Customer from "../views/home/Customer.vue";
import Shops from "../views/home/Shops.vue";
import Express from "../views/home/Express.vue";
import Index from "../views/index";

//ds
import dsLogin from "../views/DS/Login";
import dsShops from "../views/DS/Shops";
import dsRegiest from "../views/DS/Register"

Vue.use(VueRouter);

const routes = [
  {
    path:"/index",
    name:"index",
    component:Index
  },
  {
    path: "/",
    name: "Home",
    component: Login
  },
  {
    path: "/customer",
    name: "customer",
    component: Customer
  },
  {
    path:"/customer/wodedingdan",
    name:"customer/wodedingdan",
    component:()=>import("../views/home/wodedingdan")
  },
  {
    path: "/shops",
    name: "shops",
    component: Index
  },
  {
    path:'/nav',
    name:"nav",
    component:()=>import("../components/nav.vue")
  },
  {
    path: "/shops/myshop",
    name: "myshop",
    component: () => import("../views/dashboard/myshop.vue"),
    meta: { title: "我的商铺" }
  },
  {
    path: "/shops/shop",
    name: "shop",
    component: () => import("../views/dashboard/shopmange.vue"),
    meta: { title: "商铺管理" }
  },
  {
    path: "/shops/food",
    name: "food",
    component: () => import("../views/dashboard/foodmange.vue"),
    meta: { title: "食品管理" }
  },
  {
    path: "/shops/order",
    name: "order",
    component: () => import("../views/dashboard/dingdan.vue"),
    meta: { title: "订单管理" }
  },
  {
    path: "/shops/add",
    name: "addshop",
    component: () => import("../views/dashboard/addshop.vue"),
    meta: { title: "添加商铺" }
  },
  {
    path: "/express",
    name: "express",
    component: Express
  },
  {
    path: "/login",
    name: "login",
    component: Login
  },
  {
    path: "/register",
    name: "register",
    component: Register
  },
  {
    path:"/ds",
    name:"ds",
    component:dsLogin,
  },
  {
    path:"/ds/register",
    name:"dsregiest",
    component:dsRegiest
  },
  {
    path:"/ds/shops",
    redirect:"/ds/index",
  },{
    path:'/ds/index',
    name:"dsindex",
    component:() => import("../views/DS/index")
  },
  {
    path:"/ds/shops/food",
    name:"dsfood",
    component:()=>import("../views/DS/food")
  },
  {
    path:"/ds/shops/order",
    name:"dsorder",
    component:()=>import("../views/DS/order")
  },
  {
    path:"/ds/customer",
    name:"dscustomer",
    component:()=>import("../views/DS/customer")
  },
  {
    path:"/ds/customer/order",
    name:"/cusorder",
    component:()=>import("../views/DS/cusorder")
  },
  {
    path:"/ds/express",
    name:"dsexpress",
    component:()=>import("../views/DS/express")
  },{
    path:"/ds/goods/add",
    name:"/dsadd",
    component:()=>import("../views/DS/addfoods")
  },
  {
    path:"/ds/goods/edit/:id",
    name:"dsedit",
    component:()=>import("../views/DS/editfoods")
  }
  
  
];

// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
const router = new VueRouter({
  mode: "hash",
  base: process.env.BASE_URL,
  routes
});

export default router;
